#!/bin/sh

> tmp$$
cat CompositeStocks |sort |uniq  |while read stock
do
    rating=`curl -stderr "http://www.stockta.com/cgi-bin/opinion.pl?symb=$stock&num1=4&mode=stock"|sed 's/TR/\n/g' |grep "Trend Spotter"  |egrep -o ">Buy<|>Sell<|>Hold<" |sed -e 's/>//g' -e 's/<//g'`
    echo $stock $rating >> tmp$$
done

cat tmp$$ |grep -i Buy  |awk '{print $1}' > TrendSpotterLongList
cat tmp$$ |grep -i Sell  |awk '{print $1}' > TrendSpotterShortList

